new function(_)
{
	var parchment = new base2.Package(this, {
		name: "parchment",
		version: "unstable",
		exports: "decode_base64, encode_base64, gIsIphone, gStory, Querystring"
	});

	eval(this.imports);

	var gStory = "";
	var gIsIphone = navigator.userAgent.match(/iPhone/i);

	/* Taken from:
	 *
	 * http://ecmanaut.blogspot.com/2007/11/javascript-base64-singleton.html
	 *
	 * With minor modifications to decode a b64 string to a byte array instead
	 * of a string. */
	// Actually with some fairly major modifications to INCREASE SPEED!! :D

	var base64_tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
	var base64_tab2 = {'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7,
	    'I': 8, 'J': 9, 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15,
	    'Q': 16, 'R': 17, 'S': 18, 'T': 19, 'U': 20, 'V': 21, 'W': 22, 'X': 23,
	    'Y': 24, 'Z': 25, 'a': 26, 'b': 27, 'c': 28, 'd': 29, 'e': 30, 'f': 31,
	    'g': 32, 'h': 33, 'i': 34, 'j': 35, 'k': 36, 'l': 37, 'm': 38, 'n': 39,
	    'o': 40, 'p': 41, 'q': 42, 'r': 43, 's': 44, 't': 45, 'u': 46, 'v': 47,
	    'w': 48, 'x': 49, 'y': 50, 'z': 51, 0: 52, 1: 53, 2: 54, 3: 55,
	    4: 56, 5: 57, 6: 58, 7: 59, 8: 60, 9: 61, '+': 62, '/': 63, '=': 64};

	function encode_base64(data) {
		var out = "", a1, a2, a3, a4, b1, b2, b3;
		for (var i = 0; i < data.length; ) {
			b1 = data[i++];
			b2 = data[i++];
			b3 = data[i++];
			a1 = b1 >> 2;
			a2 = ((b1 & 3) << 4) + (b2 >> 4);
			a3 = ((b2 & 15) << 2) + (b3 >> 6);
			a4 = b3 & 63;

			// Consider other string concatenation methods?
			out += (base64_tab.charAt(a1) +
				base64_tab.charAt(a2) +
				base64_tab.charAt(a3) +
				base64_tab.charAt(a4));
		}
		if (isNaN(b2))
			out = out.slice(0, -2) + "==";
		else if (isNaN(b3))
			out = out.slice(0, -1) + "=";
		return out;
	}

	function decode_base64(data, out) {
	    out = out || [];
	    var a1, a2, a3, a4, b1, b2, b3;
	    for (var i = 0; i < data.length; ) {
	        a1 = base64_tab2[data.charAt(i++)];
	        a2 = base64_tab2[data.charAt(i++)];
	        a3 = base64_tab2[data.charAt(i++)];
	        a4 = base64_tab2[data.charAt(i++)];
	        b1 = (a1 << 2) + (a2 >> 4);
	        b2 = ((a2 & 15) << 4) + (a3 >> 2);
	        b3 = ((a3 & 3) << 6) + a4;
	        out.push(b1, b2, b3);
	    }
	    if (a4 == 64)
	        out.pop();
	    if (a3 == 64)
	        out.pop();
	    return out;
	}

	/*  Doesn't work unfortunately
	decode_base64 = function(data, out) {
	    out = out || [];
	    var chunk = Array.prototype.map.call(atob(data), function(x) {return x.charCodeAt(0);});
	    return out.concat(chunk);
	}
	*/

	/* Client-side access to querystring name=value pairs
		Version 1.2.4
		30 March 2008
		Adam Vandenberg
	*/
	function Querystring(qs) { // optionally pass a querystring to parse
		this.params = {};
		this.get=Querystring_get;

		if (qs == null);
			qs=location.search.substring(1,location.search.length);

		if (qs.length == 0)
			return;

	// Turn <plus> back to <space>
	// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
		qs = qs.replace(/\+/g, ' ');
		var args = qs.split('&'); // parse out name/value pairs separated via &

	// split out each name=value pair
		for (var i=0;i<args.length;i++) {
			var pair = args[i].split('=');
			var name = unescape(pair[0]);

			var value = (pair.length==2)
				? unescape(pair[1])
				: name;

			this.params[name] = value;
		}
	}

	function Querystring_get(key, default_) {
		var value=this.params[key];
		return (value!=null) ? value : default_;
	}

	// Taken from "Remedial Javascript" by Douglas Crockford:
	// http://javascript.crockford.com/remedial.html

	String.prototype.entityify = function () {
	    return this.replace(/&/g, "&amp;").replace(/</g,
	        "&lt;").replace(/>/g, "&gt;");
	};

	String.prototype.quote = function () {
	    var c, i, l = this.length, o = '"';
	    for (i = 0; i < l; i += 1) {
	        c = this.charAt(i);
	        if (c >= ' ') {
	            if (c === '\\' || c === '"') {
	                o += '\\';
	            }
	            o += c;
	        } else {
	            switch (c) {
	            case '\b':
	                o += '\\b';
	                break;
	            case '\f':
	                o += '\\f';
	                break;
	            case '\n':
	                o += '\\n';
	                break;
	            case '\r':
	                o += '\\r';
	                break;
	            case '\t':
	                o += '\\t';
	                break;
	            default:
	                c = c.charCodeAt();
	                o += '\\u00' + Math.floor(c / 16).toString(16) +
	                    (c % 16).toString(16);
	            }
	        }
	    }
	    return o + '"';
	};

	eval(this.exports);
};

var parchment = base2.parchment;
